package adapter

// Target 适配的目标接口
type Target interface {
	Request() string
}

// Adaptee 被适配的目标的接口
type Adaptee interface {
	SpecificRequest() string
}

type AdapteeImp struct {
}

func (a *AdapteeImp) SpecificRequest() string {
	return "this is adaptee specific request"
}

type ClassAdapter struct {
	Adaptee
}

func (ca *ClassAdapter) Request() string {
	return ca.SpecificRequest()
}

type ObjectAdapter struct {
	adaptee Adaptee
}

func NewObjectAdapter(adaptee Adaptee) *ObjectAdapter {
	return &ObjectAdapter{adaptee: adaptee}
}

func (oa *ObjectAdapter) Request() string {
	return oa.adaptee.SpecificRequest()
}
